﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace EWDTAssignment
    {
    public partial class Site1 : System.Web.UI.MasterPage
        {
        protected void Page_Load(object sender, EventArgs e)
            {
            //Session["accountID"] = 1;//to be removed
            if (Convert.ToInt32(Session["accountID"]) != 0 || Session["accountID"] != null)
                {
                string name = App_Code.Account.welcome(Convert.ToInt32(Session["accountID"]));
                CustomerStateLink.Text = "Welcome " + name;

                RegisterAndLogoutBtn.NavigateUrl = "Logout.aspx";
                int q = int.Parse(Session["accountID"].ToString());
                int dt = App_Code.DBManager.CountCartItem(q);
                if (Session["accType"]!=null)
                {
                    ManagementPanel.Visible = true;
                 }

                lbl.Text = Convert.ToString(dt);
                }
            else
                {
                CustomerStateLink.Text = "Login";
                CustomerStateLink.NavigateUrl = "Login.aspx";
                RegisterAndLogoutBtn.Text = " Register";
                RegisterAndLogoutBtn.NavigateUrl = "Agreement.aspx";
                }
            }

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
            {
            string Searchbox = txtbxSearchBox.Text.ToString();
            // List<App_Code.Search> list = new List<App_Code.Search>();
            //list = App_Code.Search.SearchList(Searchbox);
            Response.Redirect("searchResult.aspx?type=" + Searchbox);

            }

        }
    }